<?php
$id				= gpc_getIntPost("id",$id);
$cName			= gpc_getStringPost("cName");
$Status			= gpc_getIntPost("Status");
$TopBottomOrder	= gpc_getIntPost("TopBottomOrder",-1);
$order 			= gpc_getIntPost("Order",-1);
$order          = GetOrderForInsert($TopBottomOrder,$order,-1,"tblbanner");
$image			= gpc_getStringPost("ImgIntro");
$description 	= gpc_getStringPost("Description");

$tourid         = getTourIdByName($cName);
if($tourid == 0)$tourid = gpc_getIntPost('TourId');
if($tourid<=0)
{
    error_transfer("Tour not exist!");
}

if($act=="insert")
{
    $sql_insert = "insert into
	tblbanner(cName,iTourId,cImage,iStatus,cDescription,iOrder,cLanguage)
		values('$cName','$tourid','$image','$Status','$description','$order','$language')";

    $dbsql->query($sql_insert);

    //tracking:
    Insert_Tracking("Insert Banner: ".$cName);
    page_transfer("Add Banner Success");
}
elseif($id>0)
{
    $sql_update = "update tblbanner set
    			cName    = '$cName',
                iTourId  = '$tourid',
    			cImage   = '$image',
    			iStatus  = '$Status',
    			cDescription='$description'
    		where iId ='$id'";

    $dbsql->query($sql_update);

    //tracking:
    Insert_Tracking("edit Banner: ".$cName);
    page_transfer("update Banner Success!",getUrlBack());
}
exit();
?>
